package com.igeek.oa.controller;

import com.igeek.oa.entity.Recruit;
import com.igeek.oa.result.Result;
import com.igeek.oa.service.IRecruitService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @User 訫
 * @Description TODO
 * @Date 2024/8/29 16:43
 */
@RestController
@RequestMapping("/recruit")
@Api(tags = "招聘需求表的控制层")
public class RecruitController {

    @Autowired
    private IRecruitService recruitService;

    @GetMapping("/getRecruitInfos")
    @ApiOperation("获取所有的招聘需求")
    public Result getRecruitInfos() {
        try {
            List<Recruit> recruits = recruitService.list();
            if(recruits != null && !recruits.isEmpty()) {
                return new Result(true,"获取所有招聘需求成功",recruits);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        return new Result(false,"获取所有招聘需求失败");
    }
}
